package hr.infomare.drrh.pojo;

// Generated 21.09.2011. 15:44:13 by Hibernate Tools 3.2.1.GA

import hr.infomare.drrh.pomocni.PomocnaDatum;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.BudgetCommitmentStatusType;
import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.InvoiceStatusType;
import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.MessageHeader;

/**
 * Statnotif generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "STATNOTIF")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Statnotif implements java.io.Serializable {

	private Integer statnotid;
	private Resmsg resmsg;
	private String msgname;
	private String statnotty;
	private Date submdati;

	public Statnotif() {
	}

	@Id
	@Column(name = "STATNOTID", unique = true, nullable = false, precision = 9, scale = 0)
	public Integer getStatnotid() {
		return this.statnotid;
	}

	public void setStatnotid(Integer statnotid) {
		this.statnotid = statnotid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RESMSGID", nullable = false)
	public Resmsg getResmsg() {
		return this.resmsg;
	}

	public void setResmsg(Resmsg resmsg) {
		this.resmsg = resmsg;
	}

	@Column(name = "MSGNAME", nullable = false, length = 120)
	public String getMsgname() {
		return this.msgname;
	}

	public void setMsgname(String msgname) {
		this.msgname = msgname;
	}

	@Column(name = "STATNOTTY", nullable = false, length = 50)
	public String getStatnotty() {
		return this.statnotty;
	}

	public void setStatnotty(String statnotty) {
		this.statnotty = statnotty;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "SUBMDATI", nullable = false, length = 10)
	public Date getSubmdati() {
		return this.submdati;
	}

	public void setSubmdati(Date submdati) {
		this.submdati = submdati;
	}

	public void postaviVrijednosti(Integer statNotId, Resmsg resMsg,
			String msgName,
			BudgetCommitmentStatusType budgetCommitmentStatusType,
			MessageHeader messageHeader) {
		statnotid = statNotId;
		resmsg = resMsg;
		msgname = msgName;
		statnotty = budgetCommitmentStatusType != null ? budgetCommitmentStatusType
				.name() : " ";
		submdati = PomocnaDatum.XMLDatumUDate(messageHeader
				.getSubmitionTimestamp());
	}

	public void postaviVrijednosti(Integer statNotId, Resmsg resMsg,
			String msgName, InvoiceStatusType invoiceStatusType,
			MessageHeader messageHeader) {
		statnotid = statNotId;
		resmsg = resMsg;
		msgname = msgName;
		statnotty = invoiceStatusType != null ? invoiceStatusType.name() : " ";
		submdati = PomocnaDatum.XMLDatumUDate(messageHeader
				.getSubmitionTimestamp());
	}

}
